#!/bin/bash
set -eo pipefail
cd /opt/export/

runday='{{ execution_date | date_add(-3) | cst_ds }}'
hadoop fs -get -f /report/抖音中转中断量/抖音中转中断量_$runday /opt/export/抖音中转中断量_$runday


zip 抖音中转中断量_$runday.zip 抖音中转中断量_$runday/part*
/usr/local/python3/bin/python3 upload.py 抖音中转中断量/抖音中转中断量_$runday.zip 抖音中转中断量_$runday.zip

data_size=$(ls -lh 抖音中转中断量_$runday.zip | awk '{print $5}')
Message="抖音中转中断量_$runday 报表上传成功 大小: $data_size"

curl 'https://oapi.dingtalk.com/robot/send?access_token=816a8f35fd84432ffa6bff9d7714abc322628bb4a8ded86908550d2335aba613' \
   -H 'Content-Type: application/json' \
   -d "
  {\"msgtype\": \"text\",
    \"text\": {
        \"content\": \"监控内容:$Message\"
     }
  }" || true

rm -rf /opt/export/抖音中转中断量_$runday